package com.ukao.pad.ui.packPackag;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.percent.PercentRelativeLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.gprinterio.GpDevice;
import com.mcxtzhang.commonadapter.rv.OnItemClickListener;
import com.ukao.pad.R;
import com.ukao.pad.adapter.ClothingAnnexListAdapter;
import com.ukao.pad.base.MvpFragment;
import com.ukao.pad.bean.ClothesOperateStatusBean;
import com.ukao.pad.bean.ClothingInformationBean;
import com.ukao.pad.bean.ProductRelImgBean;
import com.ukao.pad.bean.ReceiptBean;
import com.ukao.pad.bean.RecheckBean;
import com.ukao.pad.bean.StrikeBean;
import com.ukao.pad.bean.StringBean;
import com.ukao.pad.consts.SaveParamets;
import com.ukao.pad.dialog.ClothesOperateStatusDialogFragment;
import com.ukao.pad.dialog.PutawayFinishFragment;
import com.ukao.pad.dialog.SetPutawayFragment;
import com.ukao.pad.eventbus.MembershipCardEvent;
import com.ukao.pad.listener.MyOnItemClickListener;
import com.ukao.pad.listener.OnConfirmClickListener;
import com.ukao.pad.presenter.PackPackagPesenter;
import com.ukao.pad.printer.CheckPrinterHelper;
import com.ukao.pad.printer.PrinterHelper;
import com.ukao.pad.printer.PrinterReceipt;
import com.ukao.pad.usbrfidreader.UsbrfidReaderHelper;
import com.ukao.pad.utils.CheckUtils;
import com.ukao.pad.utils.GsonUtil;
import com.ukao.pad.utils.KeyBoardUtil;
import com.ukao.pad.utils.T;
import com.ukao.pad.view.PackPackagView;
import com.ukao.pad.widget.ClearEditText;
import com.ukao.pad.widget.RecycleViewDivider;
import com.ukao.pad.widget.StateButton;
import com.ukao.pad.widget.StateImageView;

import org.greenrobot.eventbus.Subscribe;

import java.text.SimpleDateFormat;
import java.util.ArrayList;

import java.util.Date;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;
import butterknife.Unbinder;
import info.hoang8f.android.segmented.SegmentedGroup;

/**
 * 质检打包
 */
public class packPackagFragment extends MvpFragment<PackPackagPesenter> implements PackPackagView{
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    private Unbinder unbinder;
    @BindView(R.id.search_edit_text)
    ClearEditText searchEditText;  //搜索输入框
    @BindView(R.id.search_button)
    StateImageView searchButton;  //搜索按钮
    @BindView(R.id.statusText)
    TextView statusText;
    @BindView(R.id.tv_title)
    TextView tvTitle;   //标题
    @BindView(R.id.tv_store_name)
    TextView tvShopName;
    @BindView(R.id.my_recycler_view)
    RecyclerView MyRecyclerView;
    @BindView(R.id.product_name)
    TextView  tvProductName;
    @BindView(R.id.tv_clothing_code)
    TextView tvClothingCode;
    @BindView(R.id.tv_service_name)
    TextView tvServiceName;
    @BindView(R.id.tv_photo_amount)
    TextView  tvPhotoCount;
    @BindView(R.id.tv_query_picture)
    TextView  tvQueryPicture;    //查看按钮
    @BindView(R.id.tv_color_name)
    TextView tvColorName;
    @BindView(R.id.print_receipt_btn)
    StateButton printBtn;
    @BindView(R.id.tv_brand_name)
    TextView tvBrandName;
    @BindView(R.id.tv_attach_content)
    TextView tvAttachContent;
    @BindView(R.id.tv_flaw_content)
    TextView tvFlawContent;
    @BindView(R.id.tv_laundry_result)
    TextView tvLaundryResult;
    @BindView(R.id.operating_txt)
    TextView  tvOperatingText;
    @BindView(R.id.tv_operator_name)
    TextView tvOperatorName;
    @BindView(R.id.tv_convey_type)
    TextView tvConveyType;
    @BindView(R.id.tv_pass_process)
    TextView tvPassProcess;
    //衣服百分比相对布局
    @BindView(R.id.clothing_percent_layout)
    PercentRelativeLayout mPercentRelativeLayout;

    @BindView(R.id.factoryShelfNo)
    TextView factoryShelfNo;
    @BindView(R.id.radio_button1)
    RadioButton radioButton1;
    @BindView(R.id.radio_button2)
    RadioButton radioButton2;
    @BindView(R.id.segmented_group)
    SegmentedGroup segmentedGroup;   //分段的组  组控件
    @BindView(R.id.rewashing_btn)
    StateButton rewashingBtn;
    @BindView(R.id.print_qualified_btn)
    StateButton strikeBtn;
    @BindView(R.id.center_layout)
    LinearLayout centerLayout;
    @BindView(R.id.bottom_layout)
    RelativeLayout bottomLayout;
    private String mParam1;
    private String mParam2;
    private RecheckBean.ProductInfoBean productInfo;
    private ArrayList<StringBean> mEffectDescList;
    private ArrayList<StringBean> mFlawDescList;
    private String strScanCode;
    private ArrayList<String> mPhotoData = new ArrayList<>();
    private String qualifiedId;
    private SetPutawayFragment mSetPutawayFragment;
    private int proIndex;
    private int proTotal;
    private boolean isPackPackag;
    private ClothingAnnexListAdapter clothingAttachmentListAdapter;  //衣物附件的Adapter
    private String operateStr;

    public static packPackagFragment newInstance(boolean isPackPackag, String param2) {
        packPackagFragment fragment = new packPackagFragment();
        Bundle args = new Bundle();
        args.putBoolean(ARG_PARAM1, isPackPackag);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            isPackPackag = getArguments().getBoolean(ARG_PARAM1,false);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initAdapter();
    }

    @Override
    protected PackPackagPesenter createPresenter() {
        return new PackPackagPesenter(this);
    }

    @Override
    protected void initView() {
      UsbrfidReaderHelper.getInstance().readCardNum();
        if (isPackPackag) {
            segmentedGroup.setVisibility(View.VISIBLE);
            tvTitle.setVisibility(View.GONE);
            if (SaveParamets.isAutoPutaway()){
                radioButton1.setChecked(true);
            }else{
                radioButton2.setChecked(true);
            }
        }
        String name = SaveParamets.getValname();
        tvTitle.setText(name);
        operateStr=" 已操作" + "【" + name + "】";
        tvOperatingText.setText(operateStr);
        searchEditText.requestFocus();
    }
    @Override
    protected void initAdapter() {
        initLinearRecyclerView(MyRecyclerView);
        //添加分割线
        MyRecyclerView.addItemDecoration(new RecycleViewDivider(getActivity(),
                LinearLayoutManager.HORIZONTAL));
        List<ClothingInformationBean.AnnexListBean> list=new ArrayList<>();
        clothingAttachmentListAdapter=new ClothingAnnexListAdapter(getActivity(),list);
        MyRecyclerView.setAdapter(clothingAttachmentListAdapter);
        clothingAttachmentListAdapter.setOnItemClickListener(mOnItemClick);
    }

    /**
     * 右边附件列表item 点击事件
     */
    private OnItemClickListener mOnItemClick=new MyOnItemClickListener(){
        @Override
        public void onItemClick(ViewGroup viewGroup, View view, Object o, int i) {
            super.onItemClick(viewGroup, view, o, i);
           TextView textView =(TextView)view.findViewById(R.id.tv_clothing_code);
            ClothingInformationBean.AnnexListBean cosb=clothingAttachmentListAdapter.getDatas().get(i);
            mvpPresenter.requestSingleClothingOperateRecord(getActivity(),String.valueOf(cosb.getId()),
                    cosb.getProductName(),textView.getText().toString());
        }
    };


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_pack_packag, container, false);
        unbinder = ButterKnife.bind(this, view);
        initView();
        initListener();
        return view;
    }
    @Override
    protected void initListener() {
        super.initListener();
        searchEditText.setOnEditorActionListener(mOnEditorAction);
    }

    TextView.OnEditorActionListener mOnEditorAction = new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (!CheckUtils.isNull(event) && event.getKeyCode() == KeyEvent.KEYCODE_ENTER || actionId == EditorInfo.IME_ACTION_DONE) {
                searchScanCode();
            }
            return false;
        }
    };


    @OnCheckedChanged({R.id.radio_button1, R.id.radio_button2})
    public void OnCheckedChanged(CompoundButton view, boolean checked) {
        if (checked) {
            switch (view.getId()) {
                case R.id.radio_button1:
                    if (!SaveParamets.isAutoPutaway()){
                        mvpPresenter.factoryMachineupdate(_mActivity,"1",radioButton2);
                    }
                    break;
                case R.id.radio_button2:
                    if (SaveParamets.isAutoPutaway()) {
                        mvpPresenter.factoryMachineupdate(_mActivity,"2",radioButton1);
                    }
                    break;
            }
        }
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
        UsbrfidReaderHelper.getInstance().cancelReadCardNum();
    }


    @Override
    protected boolean useEventBus() {
        return true;
    }

    @Subscribe
    public void onEvent(MembershipCardEvent event) {
        switch (event.getMessage()) {
            case cardNum:/*成功*/
                String rfidSecretCard = (String) event.getData();
                searchEditText.setText(rfidSecretCard);
                searchScanCode();
                break;
        }
    }
    @OnClick({R.id.search_button,R.id.print_receipt_btn,R.id.rifd_btn,R.id.print_qualified_btn,
            R.id.tv_query_picture,R.id.rewashing_btn,R.id.clothing_percent_layout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case  R.id.rifd_btn:  //射频识别
                UsbrfidReaderHelper.getInstance().readCardNum();
                break;
            case R.id.print_receipt_btn:   //打印小票
                mvpPresenter.printReceipt(_mActivity, productInfo.getOrderId() + "");
                break;
            case R.id.search_button:  //搜索
                searchScanCode();
                hideSoftInput();
                break;
            case R.id.rewashing_btn:  /*返洗*/
                if (CheckUtils.isEmpty(strScanCode)) return;
                    mvpPresenter.stockRework(strScanCode);
                break;
            case R.id.print_qualified_btn:/*合格標*/
                if (!CheckUtils.isEmpty(qualifiedId))
                    mvpPresenter.conformity(_mActivity, qualifiedId);
                break;
            case R.id.tv_query_picture: /*查看相片*/
                if (CheckUtils.isEmpty(mPhotoData)) return;
                Intent mIntent = new Intent(_mActivity, PhotoActivity.class);
                mIntent.putStringArrayListExtra(ARG_PARAM1, mPhotoData);
                mIntent.putExtra(ARG_PARAM2, 0);
                startActivity(mIntent);
                break;
            case R.id.clothing_percent_layout:  //衣物名称
                if(!TextUtils.isEmpty(productInfo.getId())){
                    mvpPresenter.requestSingleClothingOperateRecord(_mActivity, productInfo.getId(),
                            tvProductName.getText().toString(),tvClothingCode.getText().toString());
                }
                break;
        }
    }
    /**
     * 搜索扫码条码
     */
    private void searchScanCode() {
        String strScanCode = getText(searchEditText);
        if (strScanCode.isEmpty()) return;
        mvpPresenter.stationScanCode(_mActivity, strScanCode);
    }

    /**
     * 加载搜索数据成功
     * @param mRecheckBean
     */
    @Override
    public void loadSearchData(RecheckBean mRecheckBean) {
        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        centerLayout.setVisibility(View.VISIBLE);
        bottomLayout.setVisibility(View.VISIBLE);
        productInfo = mRecheckBean.getProductInfo();
        strScanCode = productInfo.getScanCode();

        //设置已操作过流程
        if(productInfo.getStationCreateTime()!=0){
            Date d2=new Date(productInfo.getStationCreateTime());
            String strTime=format.format(d2);
            strTime+=operateStr;
            tvOperatingText.setText(strTime);  //设置操作文本
        }else {
            tvOperatingText.setText(operateStr);
        }

        //设置标志和门店名
        String storeInfo ="";
        if(!TextUtils.isEmpty(productInfo.getMark())){
            storeInfo +=productInfo.getMark()+" ";
        }
        if(!TextUtils.isEmpty(productInfo.getStoreName())){
            storeInfo +=productInfo.getStoreName();
        }
        tvShopName.setText(storeInfo);
        //设置衣物名
        if(!TextUtils.isEmpty(productInfo.getProductName())){
            tvProductName.setText(productInfo.getProductName()); //设置产品名
        }else {
            tvProductName.setText("");
        }
        //设置衣物条码
        if(!TextUtils.isEmpty(productInfo.getBindAliasCode())){
            tvClothingCode.setText(productInfo.getBindAliasCode());
        }else if(!TextUtils.isEmpty(productInfo.getBindCode())){
            tvClothingCode.setText(productInfo.getBindCode());
        }else if(!TextUtils.isEmpty(productInfo.getScanCode())){
            tvClothingCode.setText(productInfo.getScanCode());
        }else {
            tvClothingCode.setText("");
        }
        //设置输出线
        tvConveyType.setText("输"+productInfo.getTranNum());  //输出线
        //设置经过流程
        if(!TextUtils.isEmpty(productInfo.getStatusText())){
            if(productInfo.getStatusText().trim().equals("已洗完")){
                tvPassProcess.setTextColor(getResources().getColor(R.color.green));
            }else if(productInfo.getStatusText().trim().equals("洗涤中")){
                tvPassProcess.setTextColor(getResources().getColor(R.color.warm_red));
            }else {
                tvPassProcess.setTextColor(getResources().getColor(R.color.white));
            }
            Date d1=new Date(productInfo.getStatusTime());
            String strTime=format.format(d1);
            tvPassProcess.setText(productInfo.getStatusText()+"\n"+strTime);  //经过流程和时间
        }else {
            tvPassProcess.setText("");
            tvPassProcess.setTextColor(getResources().getColor(R.color.white));
        }
        //设置操作员
        String inputCode=getText(searchEditText);
        tvOperatorName.setText(productInfo.getStatusWorkName());

        //设置是否选择中的是衣物条码
        if(inputCode.equals(productInfo.getScanCode())||inputCode.equals(productInfo.getBindCode())
                ||inputCode.equals(productInfo.getBindAliasCode())){
            mPercentRelativeLayout.setBackgroundResource(R.drawable.shape_clothin_selected_bg);
            //衣物被选中，获得衣物id, 用于打印合格标
            qualifiedId = productInfo.getId();
        }else {
            mPercentRelativeLayout.setBackgroundResource(R.drawable.shape_edit_text_black);
        }
        //设置服务项目
        String serviceName;
        if(productInfo.getServiceName()==null){
            serviceName="";
        }else {
            serviceName=productInfo.getServiceName();
        }
        tvServiceName.setText(serviceName);
        //设置照片数量
        if(!TextUtils.isEmpty(productInfo.getPicCnt())){
            tvPhotoCount.setText(productInfo.getPicCnt());
        }else {
            tvPhotoCount.setText("");
        }
        //添加照片数据
        mPhotoData.clear();
        if(mRecheckBean.getProductImgList()!=null){
            for (ProductRelImgBean productRelImgBean : mRecheckBean.getProductImgList()) {
                mPhotoData.add(productRelImgBean.getCameraImg());
            }
        }
        //设置颜色
        String  color="";
        Gson gson=  GsonUtil.getInstance();
        if(!TextUtils.isEmpty(productInfo.getColorDesc())){
            List<StringBean> mColorDescList = gson.fromJson(productInfo.getColorDesc(),
                    new TypeToken<List<StringBean>>() {
                    }.getType());
            StringBuffer mColorBuffer1 = new StringBuffer();
            for (int i = 0; i < mColorDescList.size(); i++) {
                if (i != mColorDescList.size() - 1) {
                    mColorBuffer1.append(mColorDescList.get(i).getName() + "/");
                } else {
                    mColorBuffer1.append(mColorDescList.get(i).getName());
                }
            }
            color= mColorBuffer1.toString();
        }
        tvColorName.setText(color);
        //设置品牌的名字
        tvBrandName.setText(productInfo.getBrandName());  //品牌的名字
        //附加服务
        if (!CheckUtils.isEmpty(productInfo.getAddServiceDesc())) {
            List<StringBean> mServiceDescList = gson.fromJson(productInfo.getAddServiceDesc(),
                    new TypeToken<List<StringBean>>() {
                    }.getType());
            String service = "";
            for (StringBean item : mServiceDescList) {
                service = service + item.getName() + CheckUtils.isEmptyNumber(item.getAmt()) + "元" + ",";
            }
            if (service.endsWith(","))
                service = service.substring(0, service.length() - 1);
            tvAttachContent.setText(service); /* 附加f服务  */
        } else {
            tvAttachContent.setText("");
        }
        //瑕疵
        if (!CheckUtils.isEmpty(productInfo.getFlawDesc())) {
            mFlawDescList = gson.fromJson(productInfo.getFlawDesc(),
                    new TypeToken<List<StringBean>>() {
                    }.getType());
            String strFlawDesc = "";
            for (StringBean item : mFlawDescList) {
                strFlawDesc = strFlawDesc + item.getName() + "/";
            }
            if (strFlawDesc.endsWith("/"))
                strFlawDesc = strFlawDesc.substring(0, strFlawDesc.length() - 1);
            tvFlawContent.setText(strFlawDesc); /*瑕疵*/
        } else {
            tvFlawContent.setText("");
        }
        //洗后效果
        if (!CheckUtils.isEmpty(productInfo.getEffectDesc())) {
            mEffectDescList = gson.fromJson(productInfo.getEffectDesc(),
                    new TypeToken<List<StringBean>>() {
                    }.getType());
            String strEffectDesc = "";
            for (StringBean item : mEffectDescList) {
                strEffectDesc = strEffectDesc + item.getName() + "/";
            }
            if (strEffectDesc.endsWith("/"))
                strEffectDesc = strEffectDesc.substring(0,strEffectDesc.length() - 1);
            tvLaundryResult.setText(strEffectDesc); /*洗后效果*/
        } else {
            tvLaundryResult.setText("");
        }
        this.cleanCode();
        //判断衣物附件被选中
        if(mRecheckBean.getAnnexList()!=null){
            for (ClothingInformationBean.AnnexListBean bean : mRecheckBean.getAnnexList()) {
                if (inputCode.equals(bean.getBindCode()) || inputCode.equals(bean.getScanCode()) ||
                        inputCode.equals(bean.getBindAliasCode())) {
                        bean.setChecked(true);
                    qualifiedId=String.valueOf(bean.getId());
                }
            }
        }
        clothingAttachmentListAdapter.setSelectedItem(inputCode);
        clothingAttachmentListAdapter.setDatas(mRecheckBean.getAnnexList());
        if (mRecheckBean.isNeedShelf()) {   //  是否需要设置上架号
            mSetPutawayFragment = SetPutawayFragment.newInstance(mRecheckBean, "");
            mSetPutawayFragment.setOnConfirmClickListener(new OnConfirmClickListener() {
                @Override
                public void onChildItemClick(int id, Object msg) {
                    String number = (String) msg;
                    mvpPresenter.setPutaway(_mActivity, productInfo.getOrderId() + "", number);
                }
            });
            mSetPutawayFragment.show(getChildFragmentManager(), mSetPutawayFragment.getClass().getName());
        }
//判断是否打印
        if (mRecheckBean.isPrint()) {
            mvpPresenter.conformity(_mActivity, qualifiedId);
        }
        if (!isPackPackag) { /*不是质量打包打印合格证按钮隐藏*/
            strikeBtn.setVisibility(View.GONE);
            factoryShelfNo.setText("");
            printBtn.setVisibility(View.GONE);
            rewashingBtn.setVisibility(View.GONE);
            return;
        } else {
            rewashingBtn.setVisibility(productInfo.getHasRefund() != 0 ? View.GONE : View.VISIBLE);/*1代表已經退洗*/
        }
//
        if (mRecheckBean.getShelfMode()) {  /*手动上架*/
            proIndex = mRecheckBean.getProIndex();
            proTotal = mRecheckBean.getProTotal();
            String strfactoryShelfNo = mRecheckBean.getProductInfo().getFactoryShelfNo();
            if (CheckUtils.isEmpty(strfactoryShelfNo)) {
                strfactoryShelfNo = "";
            } else {
                strfactoryShelfNo = "上架号：" + strfactoryShelfNo;
            }

            factoryShelfNo.setText("第" + proIndex + "件," + "共" + proTotal + "件   " + strfactoryShelfNo);
            if (proIndex == proTotal) {
                printBtn.setVisibility(View.VISIBLE);
                mvpPresenter.downShelf(_mActivity, productInfo.getOrderId() + "");  /*释放上架号*/
                PutawayFinishFragment mPutawayFinishFragment = PutawayFinishFragment.newInstance(mRecheckBean, "");
                mPutawayFinishFragment.setOnConfirmClickListener(new OnConfirmClickListener() {
                    @Override
                    public void onChildItemClick(int id, Object msg) {
                        mvpPresenter.printReceipt(_mActivity, productInfo.getOrderId() + "");
                    }
                });
                mPutawayFinishFragment.show(getChildFragmentManager(), mPutawayFinishFragment.getClass().getName());
            } else {
                printBtn.setVisibility(View.GONE);
            }
        } else {
            factoryShelfNo.setText("");
            printBtn.setVisibility(View.GONE);
        }
    }

    private void cleanCode() {
        searchEditText.setText("");
        searchEditText.requestFocus();
        KeyBoardUtil.hideInputmethod(searchEditText);
    }


    @Override
    public void loadFail(String error) {
        T.show(error);
    }

    @Override
    public void loadReworkSucceed(String message) {
        T.show(message);
    }

    @Override
    public void loadReworkFail(String msg) {
        cleanCode();
        T.show(msg);
    }
    /**
     * 打合格
     *
     * @param mStrikeBean
     */
    @Override
    public void loadStrikeSucceed(StrikeBean mStrikeBean) {
        if (CheckPrinterHelper.isTagPrinter()) {
            PrinterHelper.getInstance().printStrike(mStrikeBean);
        }
    }

    @Override
    public void loadReceipt(ReceiptBean mReceiptBean) {
        if (mReceiptBean.getOutPrintType() && CheckPrinterHelper.isReceipt()) { /*是否用热敏小票打印机*/
            PrinterReceipt mPrinterReceipt = PrinterReceipt.getInstance();
            GpDevice mDevice = new GpDevice();
            mPrinterReceipt.printGp80(mReceiptBean, mDevice);
        } else if (CheckPrinterHelper.isWashprinter()) {  /*打标小票*/
            PrinterHelper.getInstance().printTsc247Receipt(mReceiptBean);
        }
    }

    /**
     * 上架号成功
     *
     * @param msg
     */
    @Override
    public void loadSetPutaway(String number, String msg) {
        T.show(msg);
        factoryShelfNo.setText("第" + proIndex + "件," + "共" + proTotal + "件    上架号:" + number);
        mSetPutawayFragment.dismiss();
    }

    @Override
    public void downShelf(String msg) {
        T.show(msg);
    }

    /**
     *
     * @param shelfMode  1.自动上架 2.手动上架
     */
    @Override
    public void putAwaySucceed(String shelfMode) {
        SaveParamets.setAutoPutaway(shelfMode.equals("1"));
    }

    @Override
    public void putawayFail(String msg, RadioButton mRadioButton) {
        mRadioButton.setChecked(true);
        if (!CheckUtils.isEmpty(msg)){
            T.show(msg);
        }
    }
    /**
     * 接收衣物经过的操作状态数据
     * @param
     */
    @Override
    public void receiveClothesOperateData(List<ClothesOperateStatusBean> List, String clothesName, String clothesCode) {
        ArrayList<ClothesOperateStatusBean> arrayList= (ArrayList<ClothesOperateStatusBean>) List;
        if(arrayList.size()>=1){
            ClothesOperateStatusDialogFragment  cos=  ClothesOperateStatusDialogFragment.newInstance(arrayList,clothesName,clothesCode);
            cos.show(getChildFragmentManager(),cos.getClass().getName());
        }else {
            T.show("数据是null");
        }
    }

}
